var credit = new Cesium.Credit('<a href="https://cesium.com/" target="_blank">qqqqqqqqq</a>');
var mapbox = new Cesium.MapboxImageryProvider({
	url:'http://192.168.11.37:8866/styles/',
	mapId:'dark',
	credit:credit
})
//120.391784,36.067537
/**var mapbox = new Cesium.MapboxStyleImageryProvider({
	styleId:'streets-v11',
	accessToken:'pk.eyJ1Ijoiaml1eHMzMyIsImEiOiJjaXhndTVsOWUwMDNtMnRtb3RvaGVqMnpuIn0.crb7Ug93ilVxogAU96MmxQ'
})**/

var viewer = new Cesium.Viewer("cesiumContainer", {
	animation: false,  //是否显示动画控件
	baseLayerPicker: false, //是否显示图层选择控件
	geocoder: false, //是否显示地名查找控件
	timeline: false, //是否显示时间线控件
	sceneModePicker: false, //是否显示投影方式控件
	navigationHelpButton: false, //是否显示帮助信息控件
	infoBox: false,  //是否显示点击要素之后显示的信息
	homeButton:false,
	scene3DOnly:true,
	imageryProvider: mapbox
});

/**var viewer = new Cesium.Viewer('cesiumContainer',{
	animation: false,
	timeline: false,
	imageryProviderViewModels: [tiandiMap]
});*/

viewer._cesiumWidget._creditContainer.style.display = "none";
viewer.scene.debugShowFramesPerSecond = true;
let layer0 = viewer.scene.imageryLayers.get(0);
layer0.gamma = 0.76;

/**var entity = viewer.entities.add({
     position: Cesium.Cartesian3.fromDegrees(
       120.3799993,
       36.0611937
     ),
     model: {
       uri: "data/3d.gltf",
       heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
       color: Cesium.Color.GAINSBORO,
       colorBlendAmount: 0.4
     }
});**/

// viewer.flyTo(entity,{duration:7.0});


var style = new Cesium.Cesium3DTileStyle({
	//image : 'http://192.168.11.193:8080/pic/building.png'
	color: 'color("rgba(20,91,125,0.8)")'
});

var palaceTileset = new Cesium.Cesium3DTileset({
	url: './data/tileset.json'
})
viewer.scene.primitives.add(palaceTileset);
palaceTileset.style = style;
viewer.zoomTo(palaceTileset);

/**var options = {
	lng: 120.314478,
	lat: 36.076135,
	height: 15.8,
	heading: 0.0,
	pitch: 0.0,
	roll: 0.0
}

var position = Cesium.Cartesian3.fromDegrees(options.lng, options.lat, options.height);
var pitch = Cesium.Math.toRadians(-30);
var angle = 360 / 70;
var distance = 1500;
var startTime = Cesium.JulianDate.fromDate(new Date());
viewer.clock.startTime = startTime.clone();
viewer.clock.currentTime = startTime.clone();
viewer.clock.clockRange = Cesium.ClockRange.CLAMPED;
viewer.clock.clockStep = Cesium.ClockStep.SYSTEM_CLOCK;
var initialHeading = viewer.camera.heading;
var Exection = function TimeExecution() {
	// 当前已经过去的时间，单位s
	var delTime = Cesium.JulianDate.secondsDifference(viewer.clock.currentTime, viewer.clock.startTime);
	var heading = Cesium.Math.toRadians(delTime * angle) + initialHeading;
	viewer.scene.camera.setView({
		destination :position, // 点的坐标
		orientation:{
			heading: heading,
			pitch : pitch,

		}
	});
	viewer.scene.camera.moveBackward(distance);
	if (Cesium.JulianDate.compare(viewer.clock.currentTime, viewer.clock.stopTime) >= 0) {
		viewer.clock.onTick.removeEventListener(Exection);
	}
};
viewer.clock.onTick.addEventListener(Exection);**/
/**var longitude = 120.3799993;
var latitude = 36.0611937;
height = 0;
var heading = 1;
palaceTileset.readyPromise.then(function(argument) {
    //经纬度、高转笛卡尔坐标
    var position = Cesium.Cartesian3.fromDegrees(longitude, latitude, height);
    var mat = Cesium.Transforms.eastNorthUpToFixedFrame(position);
    var rotationX = Cesium.Matrix4.fromRotationTranslation(Cesium.Matrix3.fromRotationZ(Cesium.Math.toRadians(heading)));
    Cesium.Matrix4.multiply(mat, rotationX, mat);
    palaceTileset._root.transform = mat;
})**/
			
viewer.scene.screenSpaceCameraController.zoomEventTypes=[Cesium.CameraEventType.WHEEL,Cesium.CameraEventType.PINCH];
viewer.scene.screenSpaceCameraController.tiltEventTypes=[Cesium.CameraEventType.PINCH,Cesium.CameraEventType.RIGHT_DRAG];